/********************************************************************
FileName    :   Bll_WorkGroup.cs
CreateTime  :   2015-10-27 04:10
BaseClass   :   Bll_WorkGroup
FileType    :   .cs
Author      :  minjie
Description :   Bll_WorkGroupBLL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Collections.Generic;

using System.Data;
using OS.Common;
using OS.DAL;
namespace OS.BLL
{
	/// <summary>
	/// Bll_WorkGroup的摘要说明。
	/// </summary>
public partial class   Bll_WorkGroup 
  	{ 
     		      
  		private readonly Dal_WorkGroup dal=new  Dal_WorkGroup(); 
  		public  Bll_WorkGroup() 
  		{} 
  		 
  		#region  Method 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public bool  Add(WorkGroup_Entity model) 
  		{ 
  			return dal.Add(model); 
  		} 
   
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  string  AddStr(WorkGroup_Entity model) 
  		{ 
  			return dal.AddStr(model); 
  		} 
   
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(WorkGroup_Entity model) 
  		{ 
  			return dal.Update(model); 
  		} 
   
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(string  WorkGroupId) 
  		{ 
  			 
  			return dal.Delete(WorkGroupId); 
  		} 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string WorkGroupIdlist ) 
  		{ 
  			return dal.DeleteList(WorkGroupIdlist ); 
  		} 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public WorkGroup_Entity GetModel(string  WorkGroupId) 
  		{ 
  			 
  			return dal.GetModel(WorkGroupId); 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			return dal.GetList(strWhere); 
  		} 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			return dal.GetList(Top,strWhere,filedOrder); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<WorkGroup_Entity> GetModelList(string strWhere) 
  		{ 
  			DataSet ds = dal.GetList(strWhere); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<WorkGroup_Entity> GetModelList(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			DataSet ds = dal.GetListByPage(strWhere, orderby, startIndex, endIndex); 
  			return DataTableToList(ds.Tables[0]); 
  		} 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public List<WorkGroup_Entity> DataTableToList(DataTable dt) 
  		{ 
  			List<WorkGroup_Entity> modelList = new List<WorkGroup_Entity>(); 
  		  if (dt!=null ) 
  		  { 
  			int rowsCount = dt.Rows.Count; 
  			if (rowsCount > 0) 
  			{ 
  				WorkGroup_Entity   model; 
  				for (int n = 0; n < rowsCount; n++) 
  				{ 
  					model = new WorkGroup_Entity();					 
  				model.WorkGroupId= dt.Rows[n]["WorkGroupId"].ToString(); 
  				model.PWorkGroupId= dt.Rows[n]["PWorkGroupId"].ToString(); 
  				model.WorkGroupName= dt.Rows[n]["WorkGroupName"].ToString(); 
  				model.WorkGroupRemark= dt.Rows[n]["WorkGroupRemark"].ToString(); 
  				if(dt.Rows[n]["SortNum"]!=null&&dt.Rows[n]["SortNum"].ToString()!="") 
  				{ 
  					model.SortNum=int.Parse(dt.Rows[n]["SortNum"].ToString()); 
  				} 
  				if(dt.Rows[n]["WorkGroupIsShow"]!=null&&dt.Rows[n]["WorkGroupIsShow"].ToString()!="") 
  				{ 
  					model.WorkGroupIsShow=int.Parse(dt.Rows[n]["WorkGroupIsShow"].ToString()); 
  				} 
  				model.WorkGroupRestrict= dt.Rows[n]["WorkGroupRestrict"].ToString(); 
  				 
  					modelList.Add(model); 
  				} 
  			} 
  		} 
  			return modelList; 
  		} 
   
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetAllList() 
  		{ 
  			return GetList(""); 
  		} 
   
  		/// <summary> 
  		/// 获取记录总数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			return  dal.GetRecordCount(strWhere); 
  		} 
  #endregion 
      
  	} 
  
}
